package design.pattern;

public class BMWFacroty {

    public static void main(String[] args) {
        BMW bmw = BMWFacroty.create("X1");
    }
    public static BMW create(String type){
        if (type.equals("X1")){
            return new BMWX1();
        }else if (type.equals("X2")){
            return new BMWX2();
        }
        return null;
    }

}

interface BMW{

}
class BMWX1 implements BMW{

}
class  BMWX2 implements BMW{

}
